package mo.daliy;

public class L915 {

    public int partitionDisjoint(int[] nums) {
        int index = 0, max = nums[0], leftMax = nums[0];
        for (int i = 1; i < nums.length; i++) {
            if (leftMax > nums[i]) {
                index = i;
                leftMax = max;
            } else {
                max = Math.max(max, nums[i]);
            }
        }
        return index + 1;
    }

}
